// 撤销订单核保申请
import Vue from 'vue'
import  route from '@/router/index'
import {store} from '@/store/index'
import commonFn from './common_fn.ts'


let vueObj:any = new Vue();

const revokeSubmit = {

    title: '撤回核保',
    icon: 'icon-import',
    pag: 'revokeSubmit',
    fn (){

        let orderId = route.currentRoute.query.orderId; 
        
        // 构建弹窗
        vueObj.$Modal.confirm({
            title: '请确认是否撤回核保申请',
            content: ` <h2> 订单号: ${orderId} </h2> <p style="color:#ed3f14"> 订单将回到 "暂存" 状态 !</p>  `,
            onOk (){

                store.dispatch('request', {
                    url: 'patch/order/id/status',
                    data: {
                        currentAction: '保存'
                    }
                }
                
            ).then(success =>{

                    vueObj.$Notice.success({
                        title: '撤回成功',
                    })  

                    // 延时返回管理页面
                    setTimeout(()=>{
                        commonFn('updateTable','outForm')
                    },500)
                    
                }
            )

            },
        });
        
    }

}


export default revokeSubmit; 